package top.yzhao.trackdatasystem.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.yzhao.trackdatasystem.dao.LoginDao;
import top.yzhao.trackdatasystem.dto.UserDTO;
import top.yzhao.trackdatasystem.model.User;
import top.yzhao.trackdatasystem.service.LoginService;

/**
 * User: zhaoyang
 * Date: 2020/3/12
 * Time: 21:20
 * Description: No Description
 */
@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    private LoginDao loginDao;

    public UserDTO Login(User user){
        User tmp = loginDao.Login(user);
        UserDTO data = null;
        if(tmp!=null){
            data = new UserDTO();
            data.setId(tmp.getId());
            data.setUsername(tmp.getUsername());
            data.setEmail(tmp.getEmail());
            data.setPhone(tmp.getPhone());
            data.setCreate_time(tmp.getCreate_time());
            data.setStatus(tmp.getStatus());
        }
        return data;
    }

}
